package com.sushi.enums;

import com.sushi.utils.StringUtil;

/**
 * @author wywei
 */
public class Status {

    public enum Post {
        WAIT_COMMIT("0", "待提交")
        ,WAIT_CHECK("1", "待审核")
        ,APPROVED("2", "已发布")
        ,REJECT("3", "被驳回")
        ,SHIELDED("4", "已屏蔽")
        ;
        private final String code;
        private final String value;
        private Post(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Post element : Post.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }

    public enum Comment {
        WAIT_CHECK("0", "待审核")
        ,NORMAL("1", "正常")
        ,SHIELDED("2", "已屏蔽")
        ;
        private final String code;
        private final String value;
        private Comment(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Comment element : Comment.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }

    public enum Game {
        NORMAL("0", "正常")
        ,SHIELDED("1", "已屏蔽")
        ;
        private final String code;
        private final String value;
        private Game(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Game element : Game.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }

    public enum Munual {
        NORMAL("0", "正常")
        ,SHIELDED("1", "已屏蔽")
        ;
        private final String code;
        private final String value;
        private Munual(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Munual element : Munual.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }

    public enum Message {
        NOT_READ("0", "未读")
        ,READ("1", "已读")
        ;
        private final String code;
        private final String value;
        private Message(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Message element : Message.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }

    public enum Order {
        WAIT_PAY("0", "未支付")
        ,WAIT_SELLER_SEND("1", "待卖家发货")
        ,WAIT_BUYER_CHECK("2", "待买家确认")
        ,DEAL_AFTER("3", "售后处理")
        ,OVER("4", "已完成")
        ,CANCEL("5", "已取消")
        ;
        private final String code;
        private final String value;
        private Order(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Order element : Order.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }

    public enum Activity {
        WAIT_COMMIT("0", "待提交")
        ,WAIT_CHECK("1", "待审核")
        ,APPROVED("2", "报名阶段")
        ,OPENING("3", "活动进行中")
        ,CANCEL("4", "取消")
        ,OVER("5", "圆满结束")
        ,REJECT("6", "被驳回")
        ;
        private final String code;
        private final String value;
        private Activity(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Activity element : Activity.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }

    public enum Applyer {

        APPLIED("1", "已报名")
        ,CANCEL("2", "已取消")
        ;
        private final String code;
        private final String value;
        private Applyer(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Applyer element : Applyer.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }

    public enum Commodity {

        WAIT_CHECK("0", "待审核")
        ,SELLING("1", "在售")
        ,SALES_OVER("2", "售罄")
        ,DOWN("3", "已下架")
        ,SHIELDED("4", "被屏蔽")
        ;
        private final String code;
        private final String value;
        private Commodity(String code, String value) {
            this.code = code;
            this.value = value;
        }
        public String getCode() {
            return code;
        }
        public String getValue() {
            return value;
        }
        public static String parse(String code) {
            for (Commodity element : Commodity.values()) {
                if (StringUtil.equals(element.code, code)) {
                    return element.value;
                }
            }
            return null;
        }
    }








}
